<script>
import { h } from 'vue'
export default {
    name: 'XtxBread',
    props:{
        parentName:{
            type:String,
            default:''
        },
        parentPath:{
            type:String,
            default:''  
        }
    },
    render() {
        // 插槽中插入的是BreadItem组件，所以需要把BreadItem组件渲染出来
        const items = this.$slots.default()
        const dymanicitems = []
        items.forEach((item,index)=>{
            dymanicitems.push(item)
            if(index < items.length-1) {
                dymanicitems.push(h('i', {class:'iconfont icon-angle-right'}))
            }
        })
        return h('div', {class:'xtx-bread'}, dymanicitems)
    }
}
</script>

<style lang='less'>
.xtx-bread {
    display: flex;
    padding: 25px 10px;

    &-item {
        a {
            color: #666;
            transition: all .4s;

            &:hover {
                color: @xtxColor;
            }
        }
    }

    i {
        font-size: 12px;
        margin-left: 5px;
        margin-right: 5px;
        line-height: 22px;
        &:last-child {
            display: none;
        } 
    }
}</style>